function relPLI

inDir='C:\Users\matthew\Desktop\2012\projects\RealAndImaginery\results\pli_REST_TASK\RestTaskTrials\';
outDir='C:\Users\matthew\Desktop\2012\projects\RealAndImaginery\results\pli_REST_TASK\relativePLI\';
files=dir(fullfile(inDir,'*.mat'));
load(fullfile(inDir,files(1).name));
nSubjs=length(restPLI_subjXrepXchXch);
nCh=size(restPLI_subjXrepXchXch{1},2);
relPLI_subjXchXch=zeros(nSubjs,nCh,nCh);
for i=1:length(files)
    load(fullfile(inDir,files(i).name));
    for j=1:nSubjs
        R=squeeze(mean(restPLI_subjXrepXchXch{j},1));
        T=squeeze(mean(taskPLI_subjXrepXchXch{j},1));
        relPLI_subjXchXch(j,:,:)=T./R;
    end
    save(fullfile(outDir,files(i).name),'relPLI_subjXchXch');
end

